<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
<div ng-app="">
    <p>名字 : <input type="text" ng-model="name"></p>
    <h1>Hello {{name}}</h1>
    <div ng-init="quantity=1;cost=5">
        <p>总价： {{ quantity * cost }}</p>
    </div>
    <div ng-init="points=[1,15,19,2,40]">
        <p>第三个值为 {{ points[2] }}</p>
    </div>
    <div ng-init="person={firstName:'John',lastName:'Doe'}">
        <p>姓为 <span ng-bind="person.lastName"></span></p>
    </div>
    <div ng-init="quantity=1;price=5">
        <h2>价格计算器</h2>
        数量： <input type="number"    ng-model="quantity">
        价格： <input type="number" ng-model="price">
        <p><b>总价：</b> {{ quantity * price }}</p>
    </div>
    <div ng-init="names=['Jani','Hege','Kai']">
        <p>使用 ng-repeat 来循环数组</p>
        <ul>
            <li ng-repeat="x in names">
                {{ x }}
            </li>
        </ul>
    </div>
    <div ng-init="names=[
{name:'Jani',country:'Norway'},
{name:'Hege',country:'Sweden'},
{name:'Kai',country:'Denmark'}]">
        <p>循环对象：</p>
        <ul>
            <li ng-repeat="x    in names">
                {{ x.name + ', ' + x.country }}
            </li>
        </ul>
    </div>
    <runoob-directive></runoob-directive>
    <script>
        var app = angular.module("myApp", []);
        app.directive("runoobDirective", function() {
            return {
                template : "<h1>自定义指令!</h1>"
            };
        });
    </script>
</div>

</body>